package org.thought;

import java.util.Calendar;
import java.util.GregorianCalendar;

/**
 * A class that generates an index:
 * - based on the current date
 * - with random value
 * @author Andrei Epure andrei.epure@cti.pub.ro
 *
 */

public class IndexGenerator {

	/**
	 * @param range
	 * @return a random number between 0 and range
	 */
	public static int random(int range){
		return (int)(Math.random() * range);
	}
	
	/**
	 * @param range
	 * @return a static number between 0 and range based
	 * on the current date
	 */
	public static int day(int range){
		Calendar c;
		c = new GregorianCalendar();
		return c.get(Calendar.DAY_OF_YEAR) % range;
	}
	
}
